<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="root"></div>


  <script crossorigin src="https://unpkg.com/react@18.3.1/umd/react.development.js"></script>
  <script crossorigin src="https://unpkg.com/react-dom@18.3.1/umd/react-dom.development.js"></script>
  <script crossorigin src="https://unpkg.com/babel-standalone@6.26.0/babel.min.js"></script>

  <script type="text/babel">

    class App extends React.Component {
      constructor() {
        super()
        this.state = {
          counter: 3,
          message: '玫瑰花',
          names: ['粉荔枝', '艾莎', '弗洛伊德'],
          empt: null,
          un: undefined,
          flag: true,
          obj: {
            name: '卡布奇诺'
          }
        }
      }
      render() {
        const { counter, message, names, empt, un, flag, obj } = this.state
        return (
          <div> 
            {/* 1.Number/String/Array 直接显示出来 */}
            <p>counter: { counter }</p>
            <p>message: { message }</p>
            <p>names: { names }</p>
            <p>empt: { empt } - { empt + '' }</p>
            <p>un: { un } - { String(un) }</p>
            <p>flag: { flag } - { flag.toString() }</p>
            <p>{ obj.name }</p>
          </div>
        )
      }

    }
    
    const root = ReactDOM.createRoot(document.querySelector('#root'))
    root.render(<App/>)
  </script>
</body>
</html>